package vilas.eti.controller;

import java.util.List;

import br.com.caelum.vraptor.Get;
import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.Result;
import eti.vilas.beans.DBConnection;
import eti.vilas.beans.Item;

@Resource
public class ItemController
{

	DBConnection  dbConnection = DBConnection.getInstance();
   private final Result result;
   
   public ItemController(Result result)
   {
      
      this.result = result;
   }
   
   
   @Get
   @Path("/listar")
   public List<Item> listar()
   {
      List<Item> items = dbConnection.getGroupByComgustivel();
      result.include("tam", items.size());
      return items;
   }
   
}
